<template>
	<view>
		<view class="head">
			<view class="head_left" @tap="back()">
				<image src="../../../static/wode/return.png" mode=""></image>
			</view>
			<view class="head_mid">
				身份认证
			</view>
			<view class="head_left">

			</view>
		</view>
		<picker class="body_top_item1" mode="selector" :range="shenfenArr" @change="changeShenfen">
			<view class="body_top_item ">
				<text>身份</text>
				<view class="body_item_right">
					<text>{{shenfen}}</text>
					<image src="../../../static/right.png" mode=""></image>
				</view>
			</view>
		</picker>
		<view class="" v-if="shenfen=='学生'">
			<view class="body">
				<view class="body_top">
					<view class="body_top_item">
						<text>学校名称</text>
						<view class="body_item_right">
							<input v-model="school_name" placeholder="请输入" />
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item">
						<text>系</text>
						<view class="body_item_right">
							<input type="text" value="" v-model="department" placeholder="请输入" />
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item">
						<text>专业</text>
						<view class="body_item_right">
							<input type="text" value="" v-model="specialty" placeholder="请输入" />
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item">
						<text>语种</text>
						<view class="body_item_right">
							<input type="text" value="" v-model="language" placeholder="请输入" />
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item" @tap="selectJiguan">
						<text>籍贯</text>
						<view class="body_item_right">
							<text class="" v-if="jiguan!=''">{{jiguan}}</text>
							<text v-else>请选择</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item" @tap="selectCountry">
						<text>所在城市</text>
						<view class="body_item_right">
							<text class="" v-if="suozaidi!=''">{{suozaidi}}</text>
							<text v-else>请选择</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item">
						<text>手机</text>
						<view class="body_item_right">
							<input type="text" value="" v-model="phone" placeholder="请输入" />
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item">
						<text>邮箱</text>
						<view class="body_item_right">
							<input type="text" value="" v-model="email" placeholder="请输入" />
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
				</view>
				<textarea class="jianjie" value="" placeholder="个人简介" v-model="brief" />
				<view class="body_mid">
				<view class="mid_item">
					<text class="title">请上传学生证正面照片</text>
					<view class="picBox" @tap="gettoken('card_front')">
						<image class="selected-img" v-if="card_front!=''" :src="card_front"></image>
						<image v-else src="../../../static/wode/add.png"></image>
					</view>
					<view class="tips">
						*<text>上传证件必须清晰可见</text>
					</view>
				</view>
				<view class="mid_item">
					<text class="title">请上传手持学生证照片</text>
					<view class="picBox" @tap="gettoken('card_onhand')">
						<image class="selected-img" v-if="card_onhand!=''" :src="card_onhand"></image>
						<image v-else src="../../../static/wode/add.png"></image>
					</view>
					<view class="tips">
						*<text>上传证件与本人必须清晰可见</text>
					</view>
				</view>
			</view>
			<view class="tips2">
				<image src="../../../static/wode/askImage.png" mode=""></image>
				<text>照片仅供后台审核使用，绝不对外展示。</text>
			</view>
		</view>
		<view class="btn" @tap="toProve">
			提交审核
		</view>
		</view>
		<view class="" v-else-if="shenfen=='留学生'">
			<view class="body">
					<view class="body_top">
						<view class="body_top_item" @tap="selectCountry">
							<text>留学城市</text>
							<view class="body_item_right">
								<text class="" v-if="suozaidi!=''">{{suozaidi}}</text>
								<text v-else>请选择</text>
								<image src="../../../static/right.png" mode=""></image>
							</view>
						</view>
						<view class="body_top_item">
							<text>学校名称</text>
							<view class="body_item_right">
								<input v-model="school_name" placeholder="请输入" />
								<image src="../../../static/right.png" mode=""></image>
							</view>
						</view>
						<view class="body_top_item">
							<text>系</text>
							<view class="body_item_right">
								<input type="text" value="" v-model="department" placeholder="请输入" />
								<image src="../../../static/right.png" mode=""></image>
							</view>
						</view>
						<view class="body_top_item">
							<text>专业</text>
							<view class="body_item_right">
								<input type="text" value="" v-model="specialty" placeholder="请输入" />
								<image src="../../../static/right.png" mode=""></image>
							</view>
						</view>
						<view class="body_top_item">
							<text>语种</text>
							<view class="body_item_right">
								<input type="text" value="" v-model="language" placeholder="请输入" />
								<image src="../../../static/right.png" mode=""></image>
							</view>
						</view>
						<view class="body_top_item" @tap="selectJiguan">
							<text>籍贯</text>
							<view class="body_item_right">
								<text class="" v-if="jiguan!=''">{{jiguan}}</text>
								<text v-else>请选择</text>
								<image src="../../../static/right.png" mode=""></image>
							</view>
						</view>
						<view class="body_top_item">
							<text>手机</text>
							<view class="body_item_right">
								<input type="text" value="" v-model="phone" placeholder="请输入" />
								<image src="../../../static/right.png" mode=""></image>
							</view>
						</view>
						<view class="body_top_item">
							<text>邮箱</text>
							<view class="body_item_right">
								<input type="text" value="" v-model="email" placeholder="请输入" />
								<image src="../../../static/right.png" mode=""></image>
							</view>
						</view>
					</view>
					<textarea class="jianjie" value="" placeholder="个人简介" v-model="brief" />
					<view class="body_mid">
					<view class="mid_item">
						<text class="title">请上传学生证正面照片</text>
						<view class="picBox" @tap="gettoken('card_front')">
							<image class="selected-img" v-if="card_front!=''" :src="card_front"></image>
							<image v-else src="../../../static/wode/add.png"></image>
						</view>
						<view class="tips">
							*<text>上传证件必须清晰可见</text>
						</view>
					</view>
					<view class="mid_item">
						<text class="title">请上传手持学生证照片</text>
						<view class="picBox" @tap="gettoken('card_onhand')">
							<image class="selected-img" v-if="card_onhand!=''" :src="card_onhand"></image>
							<image v-else src="../../../static/wode/add.png"></image>
						</view>
						<view class="tips">
							*<text>上传证件与本人必须清晰可见</text>
						</view>
					</view>
				</view>
				<view class="tips2">
					<image src="../../../static/wode/askImage.png" mode=""></image>
					<text>照片仅供后台审核使用，绝不对外展示。</text>
				</view>
			</view>
			<view class="btn" @tap="toProve">
				提交审核
			</view>
		</view>
		<view class="" v-else-if="shenfen=='华侨'||shenfen=='华裔'">
			<view class="body">
				<view class="body_top">
					<view class="body_top_item" @tap="selectJiguan">
						<text>籍贯</text>
						<view class="body_item_right">
							<text class="" v-if="jiguan!=''">{{jiguan}}</text>
							<text v-else>请选择</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item" @tap="selectCountry">
						<text>所在城市</text>
						<view class="body_item_right">
							<text class="" v-if="suozaidi!=''">{{suozaidi}}</text>
							<text v-else>请选择</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
				</view>
				<view class="body_mid">
					<view class="mid_item" @tap="gettoken('card_front')">
						<text class="title">请上传绿卡或护照正面照片</text>
						<view class="picBox">
							<image class="selected-img" v-if="card_front!=''" :src="card_front"></image>
							<image v-else src="../../../static/wode/add.png"></image>
						</view>
						<view class="tips">
							*<text>上传证件必须清晰可见</text>
						</view>
					</view>
					<view class="mid_item" @tap="gettoken('card_back')">
						<text class="title">请上传绿卡或护照反面照片</text>
						<view class="picBox">
							<image class="selected-img" v-if="card_back!=''" :src="card_back"></image>
							<image v-else src="../../../static/wode/add.png"></image>
						</view>
						<view class="tips">
							*<text>上传证件必须清晰可见</text>
						</view>
					</view>
				</view>
				<view class="tips2">
					<image src="../../../static/wode/askImage.png" mode=""></image>
					<text>照片仅供后台审核使用，绝不对外展示。</text>
				</view>
			</view>
			<view class="btn" @tap="toProve">
				提交审核
			</view>
		</view>
		<view class="" v-else-if="shenfen=='境外工作'">
			<view class="body">
				<view class="body_top">
					<view class="body_top_item" @tap="selectJiguan">
						<text>籍贯</text>
						<view class="body_item_right">
							<text class="" v-if="jiguan!=''">{{jiguan}}</text>
							<text v-else>请选择</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item" @tap="selectCountry">
						<text>所在城市</text>
						<view class="body_item_right">
							<text class="" v-if="suozaidi!=''">{{suozaidi}}</text>
							<text v-else>请选择</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item">
						<text>所在单位</text>
						<view class="body_item_right">
							<input v-model="unit" type="text" value="" placeholder="请输入" />
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item">
						<text>出国日期</text>
						<view class="body_item_right">
							<picker class="input rightText" mode="date" start="1971-01-01" :end="endDate" @change="bindDateChange">
								<view class="uni-input">{{goAbroadDate}}</view>
							</picker>
							<image class="rightImg" src="../../../static/wode/arrow_right.png" mode=""></image>
						</view>
					</view>
				</view>
				<view class="body_mid">
					<view class="mid_item">
						<text class="title">请上传护照正面照片</text>
						<view class="picBox" @tap="gettoken('card_front')">
							<image class="selected-img" v-if="card_front!=''" :src="card_front"></image>
							<image v-else src="../../../static/wode/add.png"></image>
						</view>
						<view class="tips">
							*<text>上传证件必须清晰可见</text>
						</view>
					</view>
					<view class="mid_item">
						<text class="title">请上传工作证正面照片</text>
						<view class="picBox" @tap="gettoken('card_back')">
							<image class="selected-img" v-if="card_back!=''" :src="card_back"></image>
							<image v-else src="../../../static/wode/add.png"></image>
						</view>
						<view class="tips">
							*<text>上传证件必须清晰可见</text>
						</view>
					</view>
					<view class="mid_item">
						<text class="title">请上传手持工作证照片</text>
						<view class="picBox" @tap="gettoken('card_onhand')">
							<image class="selected-img" v-if="card_onhand!=''" :src="card_onhand"></image>
							<image v-else src="../../../static/wode/add.png"></image>
						</view>
						<view class="tips">
							*<text>上传证件与本人必须清晰可见</text>
						</view>
					</view>
				</view>
				<view class="tips2">
					<image src="../../../static/wode/askImage.png" mode=""></image>
					<text>照片仅供后台审核使用，绝不对外展示。</text>
				</view>
			</view>
			<view class="btn" @tap="toProve">
				提交审核
			</view>
		</view>
		<view class="" v-else-if="shenfen=='境外商人'">
			<view class="body">
				<view class="body_top">
					<view class="body_top_item" @tap="selectJiguan">
						<text>籍贯</text>
						<view class="body_item_right">
							<text class="" v-if="jiguan!=''">{{jiguan}}</text>
							<text v-else>请选择</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item" @tap="selectCountry">
						<text>所在城市</text>
						<view class="body_item_right">
							<text class="" v-if="suozaidi!=''">{{suozaidi}}</text>
							<text v-else>请选择</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item">
						<text>出国日期</text>
						<view class="body_item_right">
							<picker class="input rightText" mode="date" start="1971-01-01" :end="endDate" @change="bindDateChange">
								<view class="uni-input">{{goAbroadDate}}</view>
							</picker>
							<image class="rightImg" src="../../../static/wode/arrow_right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item">
						<text>行业</text>
						<view class="body_item_right">
							<view class="marginLeft">
								<!-- <view class="" v-if="ischange &&recordId!=''" @tap="changeIndustry">
									{{industry}}
								</view> -->
								<picker @change="bindPickerChange" :value="index" :range="array">
									<view class="uni-input">{{array[index]}}</view>
								</picker>
							</view>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
				</view>
				<view class="body_mid">
					<view class="mid_item">
						<text class="title">请上传护照</text>
						<view class="picBox" @tap="gettoken('card_front')">
							<image class="selected-img" v-if="card_front!=''" :src="card_front"></image>
							<image v-else src="../../../static/wode/add.png"></image>
						</view>
						<view class="tips">
							*<text>上传证件必须清晰可见</text>
						</view>
					</view>
					<view class="mid_item">
						<text class="title">请上传公司营业执照</text>
						<view class="picBox" @tap="gettoken('card_back')">
							<image class="selected-img" v-if="card_back!=''" :src="card_back"></image>
							<image v-else src="../../../static/wode/add.png"></image>
						</view>
						<view class="tips">
							*<text>上传证件必须清晰可见</text>
						</view>
					</view>
				</view>
				<view class="tips2">
					<image src="../../../static/wode/askImage.png" mode=""></image>
					<text>照片仅供后台审核使用，绝不对外展示。</text>
				</view>
			</view>
			<view class="btn" @tap="toProve">
				提交审核
			</view>
		</view>
		<view class="" v-else-if="shenfen=='国籍'">
			<view class="body">
				<view class="body_top">
					<view class="body_top_item" @tap="selectJiguan">
						<text>籍贯</text>
						<view class="body_item_right">
							<text class="" v-if="jiguan!=''">{{jiguan}}</text>
							<text v-else>请选择</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="body_top_item" @tap="selectCountry">
						<text>所在城市</text>
						<view class="body_item_right">
							<text class="" v-if="suozaidi!=''">{{suozaidi}}</text>
							<text v-else>请选择</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
				</view>
				<view class="body_mid">
					<view class="mid_item">
						<text class="title">请上传身份证正面照片</text>
						<view class="picBox" @tap="gettoken('card_front')">
							<image class="selected-img" v-if="card_front!=''" :src="card_front"></image>
							<image v-else src="../../../static/wode/add.png"></image>
						</view>
						<view class="tips">
							*<text>上传证件必须清晰可见</text>
						</view>
					</view>
					<view class="mid_item">
						<text class="title">请上传身份证反面照片</text>
						<view class="picBox" @tap="gettoken('card_back')">
							<image class="selected-img" v-if="card_back!=''" :src="card_back"></image>
							<image v-else src="../../../static/wode/add.png"></image>
						</view>
						<view class="tips">
							*<text>上传证件必须清晰可见</text>
						</view>
					</view>
					<view class="mid_item">
						<text class="title">请上传手持身份证照片</text>
						<view class="picBox" @tap="gettoken('card_onhand')">
							<image class="selected-img" v-if="card_onhand!=''" :src="card_onhand"></image>
							<image v-else src="../../../static/wode/add.png"></image>
						</view>
						<view class="tips">
							*<text>上传证件及本人必须清晰可见</text>
						</view>
					</view>
					
				</view>
				<view class="tips2">
					<image src="../../../static/wode/askImage.png" mode=""></image>
					<text>照片仅供后台审核使用，绝不对外展示。</text>
				</view>
			</view>
			<view class="btn" @tap="toProve">
				提交审核
			</view>
		</view>
	</view>
</template>

<script>
	import qiniu from "../../../common/qiniuUploader.js"

	export default {
		data() {
			return {
				shenfenArr:['学生','留学生','华侨','华裔','境外工作','境外商人','国籍'],//
				shenfen:'请选择',
				
				in_country:'',
				school_name:'',
				department:'',//系
				specialty:'',//专业
				language:'',
				native_place:'',//籍贯
				city:'',
				brief:'',
				card_front:'',//正面照
				card_onhand:'',//手持照
				card_back:'',//背面照
				suozaidi:'',//所在地
				jiguan:'',//籍贯
				
				//华侨
				type: '',
				identity_type: '',
				//工作
				unit: '',//单位
				
				//商人
				goAbroadDate: '请选择',
				array: ['请选择', '计算机/互联网/通信', '生产/工艺/制造', '医疗/护理/制药', '金融/银行/投资/保险', '商业/服务业/个体经营',
					'文化/广告/传媒', '娱乐/艺术/表演', '律师/法务', '教育/培训', '公务员/行政/事业单位', '模特', '空姐', '学生', '其他'
				],
				index: 0,
				endDate: '',
			};
		},
		onShow(){
			this.in_country=uni.getStorageSync('guojia')
			this.getaddres(); //获取地名
		},
		methods:{
			back(){
				uni.navigateBack({
					delta: 1
				})
			},
			changeShenfen(e){
				console.log('picker发送选择改变，携带值为', e.target.value)
				this.shenfen =this.shenfenArr[e.target.value]
			},
			bindPickerChange: function(e) {
				console.log('picker发送选择改变，携带值为', e.target.value)
				this.index = e.target.value
			},
			bindDateChange(e) {
				this.goAbroadDate = e.target.value
			},
			getaddres() {
				var countryName = uni.getStorageSync('countryName');
				var province = uni.getStorageSync('province');
				var city1 = uni.getStorageSync('city');
				var guojia = uni.getStorageSync('guojia');
				var shengfen = uni.getStorageSync('shengfen');
				var chengshi = uni.getStorageSync('chengshi');
				var isChoose = uni.getStorageSync('isChoose');
			
				if (chengshi != '' && shengfen != '') {
					this.suozaidi = guojia + ' · ' + chengshi
					this.city=chengshi
				} else if (chengshi == '' && shengfen != '') {
					this.suozaidi = guojia + ' · ' + shengfen
					this.city=shengfen
				} else {
					this.suozaidi = guojia
				}

				if (city1 != '' && province != '') {
					this.jiguan = countryName + ' · ' + city1
				} else if (city1 == '' && province != '') {
					this.jiguan = countryName + ' · ' + province
				} else {
					this.jiguan = countryName
				}
			},
			selectCountry(){
				uni.navigateTo({
					url:'../countryLists/countryLists?isNativePlace=false'
				})
			},
			selectJiguan(){
				uni.navigateTo({
					url:'../countryLists/countryLists?isNativePlace=true'
				})
			},
			// #ifdef APP-PLUS
			gettoken(type){
				this.appselectImg(type)
			},
			// #endif
			// #ifdef MP-WEIXIN
			gettoken(type) {
				var me = this;
				var data = {
					key: null,
				}
				this.myAjaxNewPost({
					model: 'push',
					controllerName: 'upload',
					actionName: 'getToken',
					data: data,
					successBack: function(res) {
			
						me.token = res.data.data
						console.log(me.token)
						if (me.token != '') {
							me.selectImg(type)
						}
			
					}
				})
			},
			// #endif
			appselectImg(type){
				var me = this;
				uni.showActionSheet({
					itemList: ['拍照', '相册'],
					itemColor: '#008AFF',
					success: function(res) {
						var index = res.tapIndex;
						if (index == 1) {
							uni.chooseImage({
								count: 1,
								sizeType: ['compressed'],
								sourceType: ['album'],
								success: function(res) {
									// me.card_front = res.tempFilePaths[0];
									var filePath = res.tempFilePaths[0];
									uni.uploadFile({
										url: 'http://www.curiousmore.com:8768/eg-api/push/upload/uploadPicture',
										// url: 'http://192.168.101.14:8768/eg-api/push/upload/uploadPicture',
										filePath: filePath,
										name: 'file',
										formData: {
											'user_id': uni.getStorageSync('user_id'),
											'type': 'pic'
										},
										success: function(uploadFileRes) {
											// me.backImgArr.push(JSON.parse(uploadFileRes.data)[0]);
											console.log(JSON.parse(uploadFileRes.data)[0]);
											var imageURL = JSON.parse(uploadFileRes.data)[0];
											if (type == 'card_front') {
												me.card_front = imageURL
											} else if (type == 'card_back') {
												me.card_back = imageURL
											} else {
												me.card_onhand = imageURL
											}
				
										},
										fail: function(e) {
											uni.showToast({
												title: '图片上传失败，请重试',
												icon: 'none'
											})
											return;
										}
									});
								}
							});
						} else if (index == 0) {
							uni.chooseImage({
								count: 1,
								sizeType: ['compressed'],
								sourceType: ['camera'],
								success: function(res) {
									// me.card_front = res.tempFilePaths[0];
				
									var filePath = res.tempFilePaths[0];
									uni.uploadFile({
										url: 'http://www.curiousmore.com:8768/eg-api/push/upload/uploadPicture',
										// url: 'http://192.168.101.14:8768/eg-api/push/upload/uploadPicture',
										filePath: filePath,
										name: 'file',
										formData: {
											'user_id': uni.getStorageSync('user_id'),
											'type': 'pic'
										},
										success: function(uploadFileRes) {
											// me.backImgArr.push(JSON.parse(uploadFileRes.data)[0]);
											console.log(JSON.parse(uploadFileRes.data)[0]);
											var imageURL = JSON.parse(uploadFileRes.data)[0];
											if (type == 'card_front') {
												me.card_front = imageURL
											} else if (type == 'card_back') {
												me.card_back = imageURL
											} else {
												me.card_onhand = imageURL
											}
									
										},
										fail: function(e) {
											uni.showToast({
												title: '图片上传失败，请重试',
												icon: 'none'
											})
											return;
										}
									});
								}
							});
						}
					}
				});
			},
			selectImg(type) {
				// this.initQiniu();
				var me = this;
				uni.chooseImage({
					count: 1,
					sizeType: ['compressed'],
					sourceType: ['album'],
					success: function(res) {
						// me.card_front = res.tempFilePaths[0];
						var filePath = res.tempFilePaths[0];
						// 交给七牛上传
						if (me.token != '') {
							uni.showLoading({
								title:'上传中'
							})
							qiniu.upload(filePath, (res) => {
								console.log(res.imageURL)
								var imageURL = res.imageURL
								if (type == 'card_front') {
									me.card_front = imageURL
								} else if (type == 'card_back') {
									me.card_back = imageURL
								} else {
									me.card_onhand = imageURL
								}
								uni.hideLoading()
								console.log('file url is: ' + res.fileUrl);
							}, (error) => {
								console.log('error: ' + error);
							}, {
								region: 'ECN',
								domain: 'http://img.curiousmore.com', // // bucket 域名，下载资源时用到。如果设置，会在 success callback 的 res 参数加上可以直接使用的 ImageURL 字段。否则需要自己拼接
								key: null, // [非必须]自定义文件 key。如果不设置，默认为使用微信小程序 API 的临时文件名
								// 以下方法三选一即可，优先级为：uptoken > uptokenURL > uptokenFunc
								uptoken: me.token, // 由其他程序生成七牛 uptoken
								// uptokenURL: 'http://192.168.6.6:8768/eg-api/push/upload/getToken', // 从指定 url 通过 HTTP GET 获取 uptoken，返回的格式必须是 json 且包含 uptoken 字段，例如： {"uptoken": "[yourTokenString]"}
								uptokenFunc: function() {
									return '[yourTokenString]';
								}
							}, (res) => {
								console.log('上传进度', res.progress)
								console.log('已经上传的数据长度', res.totalBytesSent)
								console.log('预期需要上传的数据总长度', res.totalBytesExpectedToSend)
								
							}, () => {
								// 取消上传
							}, () => {
								// `before` 上传前执行的操作
							}, (err) => {
								// `complete` 上传接受后执行的操作(无论成功还是失败都执行)
								
							});
						}
					}
				});
			},
			toProve(){
				if(this.shenfen=='学生'||this.shenfen=='留学生'){
					if(this.suozaidi==''){
						uni.showToast({
							title: '请选择留学城市',
							icon: 'none',
						})
						return;
					}	
					if(this.school_name==''){
							uni.showToast({
								title: '请输入学校名称',
								icon: 'none',
							})
							return;
					}
					if(this.department==''){
							uni.showToast({
								title: '请输入系',
								icon: 'none',
							})
							return;
					}
					if(this.specialty==''){
							uni.showToast({
								title: '请输入专业',
								icon: 'none',
							})
							return;
					}
					if(this.language==''){
							uni.showToast({
								title: '请输入语种',
								icon: 'none',
							})
							return;
					}
					if(this.jiguan==''){
							uni.showToast({
								title: '请选择籍贯',
								icon: 'none',
							})
							return;
					}
					if(this.brief==''){
							uni.showToast({
								title: '请输入个人简介',
								icon: 'none',
							})
							return;
					}
					if(this.card_front==''){
							uni.showToast({
								title: '请上传学生证正面照',
								icon: 'none',
							})
							return;
					}
					if(this.card_onhand==''){
							uni.showToast({
								title: '请上传手持学生证照片',
								icon: 'none',
							})
							return;
					}
					if(this.shenfen=='学生'){
						this.identity_type='student'
					}else if(this.shenfen=='留学生'){
						this.identity_type='overseas_student'
					}
					var data={
						user_id:uni.getStorageSync('user_id'),
						in_country:this.in_country,
						school_name:this.school_name,
						department:this.department,//系
						specialty:this.specialty,//专业
						language:this.language,
						native_place:this.jiguan,//籍贯
						city:this.city,
						brief:this.brief,
						card_front:this.card_front,//正面照
						card_onhand:this.card_onhand,//手持照
						identity_type:this.identity_type //类型
					}
				}else if(this.shenfen=='华侨'||this.shenfen=='华裔'){
					if (this.jiguan == '') {
						uni.showToast({
							title: '请选择籍贯',
							icon: 'none',
						})
						return;
					}
					if (this.suozaidi == '') {
						uni.showToast({
							title: '请选择所在城市',
							icon: 'none',
						})
						return;
					}
					if (this.card_front == '') {
						uni.showToast({
							title: '请上传绿卡或护照正面照',
							icon: 'none',
						})
						return;
					}
					if (this.card_back == '') {
						uni.showToast({
							title: '请上传绿卡或护照反面照',
							icon: 'none',
						})
						return;
					}
					if(this.shenfen=='华侨'){
						this.identity_type='overseas_chinese'
					}else if(this.shenfen='华裔'){
						this.identity_type='ethnic_chinese'
					}

					var data = {
						user_id: uni.getStorageSync('user_id'),
						in_country: this.in_country,
						native_place: this.jiguan, //籍贯
						city: this.city,
						brief: this.brief,
						card_front: this.card_front, //正面照
						card_onhand: this.card_onhand, //手持照
						identity_type: this.identity_type //类型
					}
				}else if(this.shenfen=='境外工作'){
					if (this.jiguan == '') {
						uni.showToast({
							title: '请选择籍贯',
							icon: 'none',
						})
						return;
					}
					if (this.suozaidi == '') {
						uni.showToast({
							title: '请选择所在城市',
							icon: 'none',
						})
						return;
					}
					if (this.card_front == '') {
						uni.showToast({
							title: '请上传护照正面照',
							icon: 'none',
						})
						return;
					}
					if (this.card_back == '') {
						uni.showToast({
							title: '请上传工作证正面照',
							icon: 'none',
						})
						return;
					}
					if (this.card_onhand == '') {
						uni.showToast({
							title: '请上传手持工作照照片',
							icon: 'none',
						})
						return;
					}
					var data = {
						user_id: uni.getStorageSync('user_id'),
						in_country: this.in_country,
						native_place: this.jiguan, //籍贯
						city: this.city,
						card_front: this.card_front, //正面照
						card_back: this.card_back, //工作证
						card_onhand: this.card_onhand, //手持照
						identity_type: 'overseas_staff' //类型
					}
				}else if(this.shenfen=='境外商人'){
					if (this.jiguan == '') {
						uni.showToast({
							title: '请选择籍贯',
							icon: 'none',
						})
						return;
					}
					if (this.suozaidi == '') {
						uni.showToast({
							title: '请选择所在城市',
							icon: 'none',
						})
						return;
					}
					if (this.card_front == '') {
						uni.showToast({
							title: '请上传护照',
							icon: 'none',
						})
						return;
					}
					if (this.card_back == '') {
						uni.showToast({
							title: '请上传公司营业执照',
							icon: 'none',
						})
						return;
					}
					var data = {
						user_id: uni.getStorageSync('user_id'),
						in_country: this.in_country,
						native_place: this.jiguan, //籍贯
						city: this.city,
						card_front: this.card_front, //护照
						card_back: this.card_back, //营业执照
						identity_type: 'overseas_ merchant' //类型
					}
				}else if(this.shenfen=='国籍'){
					if (this.jiguan == '') {
						uni.showToast({
							title: '请选择籍贯',
							icon: 'none',
						})
						return;
					}
					if (this.suozaidi == '') {
						uni.showToast({
							title: '请选择所在城市',
							icon: 'none',
						})
						return;
					}
					if (this.card_front == '') {
						uni.showToast({
							title: '请上传护照正面照',
							icon: 'none',
						})
						return;
					}
					if (this.card_back == '') {
						uni.showToast({
							title: '请上传工作证正面照',
							icon: 'none',
						})
						return;
					}
					if (this.card_onhand == '') {
						uni.showToast({
							title: '请上传手持工作照照片',
							icon: 'none',
						})
						return;
					}
					var data = {
						user_id: uni.getStorageSync('user_id'),
						in_country: this.in_country,
						native_place: this.jiguan, //籍贯
						city: this.city,
						card_front: this.card_front, //正面照
						card_back: this.card_back, //工作证
						card_onhand: this.card_onhand, //手持照
						identity_type: 'overseas_nationality' //类型
					}
				}
				var me=this;
				this.myAjaxNewPost({
					model: 'user',
					controllerName: 'overseasIdentity',
					actionName: 'insert',
					data: data,
					successBack:function(res){
						console.log(res)
						if(res.data.code==0){
							uni.showToast({
								title: '等待审核',
								icon: 'none',
							})
							uni.navigateBack({
								delta: 1
							})
						}
					}
				})
			},
		}
	}
</script>

<style scoped>
.head {
		width: 100%;
		display: flex;
		justify-content: space-between;
		height: 162upx;
		background: #ffffff;
		padding: 0 24upx;
		z-index: 200;
		position: fixed;
		top: 0;
		box-sizing: border-box;
	}
	
	.head image {
		width: 20upx;
		height: 36upx;
		margin-right: 9upx;
	}
	
	.head_left {
		height: 82upx;
		width: 106upx;
		display: flex;
		align-items: center;
		line-height: 82upx;
		color: #666666;
		font-size: 32upx;
		padding-top: 70upx;
	}
	.head_mid{
		padding-top: 90upx;
	}
	
	.head_right {
		width: 150upx;
	} 
	.body_top{
		background: #FFFFFF;
		color: #333333;
		font-size: 32upx;
		margin-top: 20upx;
	}
	.body_top_item{
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 88upx;
		line-height: 88upx;
		padding: 0 24upx;
		border-bottom: 1upx solid #E6E6E6;
		background: #FFFFFF;
	}
	.body_top_item1{
		padding-top: 182upx;
		font-size: 32upx;
	}
	.body_item_right{
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 500upx;
	}
	.body_item_right image{
		width: 16upx;
		height: 28upx;
	}
	.body_item_right text{
		color: #999999;
	}
	.uni-input{
		width: 100%;
	}
	.jianjie{
		background: #FFFFFF;
		height: 210upx;
		width: 100%;
		padding: 24upx;
		font-size: 32upx;
		margin-top: 20upx;
	}
	.body_mid{
		margin-top: 20upx;
		background: #FFFFFF;
	}
	.mid_item{
		display: flex;
		flex-direction: column;
		padding: 20upx 24upx;
		border-bottom: 1upx solid #E6E6E6;
	}
	.title{
		color: #333333;
		font-size: 32upx;
		font-weight: bold;
	}
	.mid_item image{
		width: 70upx;
		height: 70upx;
		margin: 0 auto;
		line-height: 350upx;
	}
	.picBox{
		width: 702upx;
		height: 350upx;
		background: #F5F5F5;
		text-align: center;
		line-height: 350upx;
		margin: 10upx 0;
	}
	.mid_item .selected-img{
		width: 100%;
		height: 100%;
	}
	.tips{
		color: #FF3636;
		font-size: 24upx;
	}
	.tips text{
		color: #999999;
	}
	.tips2 {
		margin-top: 20upx;
		margin-left: 24upx;
		display: flex;
		align-items: center;
	}
	
	.tips2 image {
		width: 40upx;
		height: 40upx;
		margin-right: 20upx;
	}
	
	.tips2 text {
		color: #666666;
		font-size: 24upx;
	}
	.btn{
		margin: 60upx 24upx;
	}
</style>
